home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 30
/
PC Gamer IT CD 30 1-2.iso
/
MOTS
/
GAMEDATA
/
RESOURCE
/
JKMRES.GOO
/
cog_weap_fists_m.cog
< prev
next >
Wrap
Text File
|
1998-02-25
|
5KB
|
210 lines
# Jedi Knight Cog Script
#
# WEAP_FISTS.COG
#
# WEAPON 1 Script - Fists
#
# The primary fire for is a punch with the left fist and then the right fist.
#
# - Not affected by MagSealed sectors/surfaces.
#
# [YB & CYW]
#
# (C) 1997 LucasArts Entertainment Co. All Rights Reserved
symbols
model povModel=fistv.3do local
model povModel_m=fistv_m.3do local
model weaponMesh=fistg.3do local
keyframe mountAnim=FistVmnt.key local
keyframe dismountAnim=FistVdis.key local
keyframe povfireAnim1=FistVl.key local
keyframe povfireAnim2=FistVr.key local
keyframe holsterAnim=kyhlstr.key local
sound fireSound1=SwingFist01.wav local
#sound fireSound2=SwingFist04.wav local
template projectile=+punch local
template projectileB=+bigpunch local
thing player local
flex leftWait=0.25 local
flex rightWait=0.25 local
flex mountWait local
flex holsterWait local
int trackID=-1 local
int nextAnim=0 local
int holsterTrack local
message startup
message activated
message deactivated
message selected
message deselected
#message newplayer
message autoselect
message fire
message timer
end
# ========================================================================================
code
startup:
player = jkGetLocalPlayer();
// Setup delays.
leftWait = GetKeyLen(povfireAnim1) / 2;
rightWait = GetKeyLen(povfireAnim2);
mountWait = GetKeyLen(mountAnim);
Return;
# ........................................................................................
fire:
// Check that the player is still alive.
if(GetThingHealth(player) <= 0)
{
Return;
}
nextAnim = GetSenderRef();
if (nextAnim < 0 || nextAnim > 1)
return;
SendMessageEx(GetThingClassCog(GetLocalPlayerThing()), user1, 3.0, 0, 0, 0);
if(nextAnim == 0)
{
// Left jab (Poke!)
SetPOVShake('-0.01 -.01 0.0', '1.0 0.0 0.0', .05, 80.0);
PlaySoundThing(fireSound1, player, 1.0, 0.5, 2.5, 0x80);
FireProjectile(player, projectile, -1, 8, '-0.02 0.03 0', '0 0 0', 1.0, 0, 0.0, 0.0);
SetFireWait(player, leftWait);
// printflex(leftWait);
}
else
{
// Right hook (Thwack!)
SetPOVShake('0.01 -.01 0.0', '1.0 0.0 0.0', .05, 80.0);
PlaySoundThing(fireSound1, player, 1.0, 0.5, 2.5, 0x80);
FireProjectile(player, projectileB, -1, 18, '0.02 0.03 0', '0 0 0', 1.0, 0, 0.0, 0.0);
SetFireWait(player, rightWait);
// printflex(rightWait);
}
jkPlayPOVKey(player, povfireAnim1[nextAnim], 1, 0x0a);
Return;
# ........................................................................................
activated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '0.0 0.0 0.0', 0);
ActivateWeapon( player, leftWait, mode );
Return;
# ........................................................................................
deactivated:
player = GetSourceRef();
mode = GetSenderRef();
jkSetWaggle(player, '10.0 7.0 0.0', 350);
DeactivateWeapon( player, mode );
Return;
# ........................................................................................
selected:
player = GetSourceRef();
PlayMode(player, 40);
// Setup the meshes and models.
if (GetInv(player, 67) == 0.0)
jkSetPOVModel(player, povModel); // Kyle hand
else
jkSetPOVModel(player, povModel_m); // Mara Hand
jkSetWeaponMesh(player, weaponMesh);
SetArmedMode(player, 0);
jkSetWaggle(player, '10.0 7.0 0.0', 350);
// Play the animation (NOLOOP + UNIQUE + ENDPAUSE).
// The animation is held at the last frame after it is played.
trackID = jkPlayPOVKey(player, mountAnim, 0, 20);
SetMountWait(player, mountWait);
// Clear saber flags, and allow activation of the weapon
jkClearFlags(player, 0x5);
SetCurWeapon(player, 1);
Return;
# ........................................................................................
deselected:
player = GetSourceRef();
// Stop the mount's last frame animation, and play the dismount.
jkPlayPOVKey(player, dismountAnim, 0, 18);
holsterWait = GetKeyLen(holsterAnim);
SetMountWait(player, holsterWait);
holsterTrack = PlayKey(player, holsterAnim, 1, 0x4);
SetTimerEx(holsterWait, 2, 0.0, 0.0);
if (trackID != -1)
{
jkStopPOVKey(player, trackID, 0);
trackID = -1;
}
jkSetWaggle(player, '0.0 0.0 0.0', 0);
Return;
# ........................................................................................
//newplayer:
// player = GetSourceRef();
//
// // Make sure that if the player is respawning, the old mount isn't playing anymore.
// if (trackID != -1)
// {
// jkStopPOVKey(player, trackID, 0);
// trackID = -1;
// }
//
// Return;
# ........................................................................................
autoselect:
// Select fists when out of everything else...
ReturnEx(100.0);
Return;
# ........................................................................................
timer:
StopKey(player, holsterTrack, 0.0);
Return;
end